<?php
require_once '../../global.inc.php';

//SESSION中取出分页信息
$totalRows      = $_SESSION["pageInfo"]["totalRows"];		//总记录数
$pageSize       = $_SESSION["pageInfo"]["pageSize"];		//每页记录数
$currentPage    = $_SESSION["pageInfo"]["currentPage"];		//当前页数
$totalPages     = $_SESSION["pageInfo"]["totalPages"];		//总页数
$startRow       = $_SESSION["pageInfo"]["startRow"];		//每页记录开始位置
$firstPage      = $_SESSION["pageInfo"]["firstPage"];		//首页
$prewPage       = $_SESSION["pageInfo"]["prewPage"];		//上一页
$nextPage       = $_SESSION["pageInfo"]["nextPage"];		//下一页
$lastPage       = $_SESSION["pageInfo"]["lastPage"];		//尾页
//SESSION中取出页面内数据信息
$userArray		= $_SESSION["userArray"];		//二维数组

//释放不需要的SESSION资源
//unset($_SESSION["pageInfo"]);
//unset($_SESSION["userArray"]);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
<!--
body {
	margin-left: 3px;
	margin-top: 0px;
	margin-right: 3px;
	margin-bottom: 0px;
}
a {text-decoration:none}
a:hover {text-decoration:none}
img {border:0px;}
.STYLE1 {
	color: #e1e2e3;
	font-size: 12px;
}
.STYLE6 {color: #000000; font-size: 12; }
.STYLE10 {color: #000000; font-size: 12px; }
.STYLE19 {
	color: #344b50;
	font-size: 12px;
}
.STYLE21 {
	font-size: 12px;
	color: #3b6375;
}
.STYLE22 {
	font-size: 12px;
	color: #295568;
}
-->
</style>
<script type="text/javascript" src="../js/utils.js"></script>
<script type="text/javascript" src="js/user.js"></script>
</head>

<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="24" bgcolor="#353c44"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td  width="70%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="6%" height="19" valign="bottom"><div align="center"><img src="../images/tb.gif" width="14" height="14" /></div></td>
                <td width="94%" valign="bottom"><div align="left"><span class="STYLE1"> 管理人员基本信息列表</span></div></td>
              </tr>
            </table></td>

            <td>
            <?php if($role==1){?>
	            <div align="right"><span class="STYLE1">
		            <!-- <input type="checkbox" name="checkbox11" id="checkbox11" />全选      &nbsp;&nbsp; -->
		            <a href='../../action/userAction.php?op=add'  target='rightFrame'><img src="../images/add.gif" width="10" height="10" /><span class="STYLE1"> 添加用户 </span>  &nbsp; </a>
		            <a href='#' target='rightFrame' onclick="delAll()"><img src="../images/del.gif" width="10" height="10" /> <span class="STYLE1">批量删除</span>    &nbsp;</a>
		            <!-- <img src="../images/edit.gif" width="10" height="10" /> 编辑   &nbsp; -->
	            </span><span class="STYLE1"> &nbsp;</span></div>
            <?php }?>
            </td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce">
      <tr>
        <td width="2%" height="20" bgcolor="d3eaef" class="STYLE10"><div align="center"><input type="checkbox" name="checkbox" id="checkbox" onclick="checkChg('checkbox','checkbox2')"/></div></td>
        <td width="10%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">用户名</span></div></td>
        <td width="8%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">用户角色</span></div></td>
        <td width="10%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">联系方式</span></div></td>
        <td width="20%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">Email地址</span></div></td>
        <td width="32%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">备注</span></div></td>
        <td width="12%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">最后一次登录时间</span></div></td>
        <td width="8%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">基本操作</span></div></td>
      </tr>
      <?php 
      foreach ($userArray as $user) {
		$userId 		= $user["user_id"];			//用户ID
		$username 		= $user["user_name"];		//用户名
		$userRole		= $user["role"];			//用户角色
		switch ($userRole) {
			case 1: $roleName="系统管理员"; 	break;		//用户角色
			case 2: $roleName="普通用户"; 		break;
		}
		$mobile			= $user["mobile"];			//联系方式
		$email			= $user["email"];			//email
		$lastLoginTime	= $user["last_login_time"];	//最后一次登录时间
		$comment		= $user["comment"];			//备注
		echo "<tr>";
	        echo "<td height='20' bgcolor='#FFFFFF'><div align='center'><input type='checkbox' name='checkbox2' id='$userId' value='$userId' /></div></td>"; 
	        echo "<td height='20' bgcolor='#FFFFFF' class='STYLE6'><div align='center'><span class='STYLE19'>$username</span></div></td>";            
	        echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'>$roleName</div></td>";                                  
	        echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'>$mobile</div></td>";                                 
	        echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'>$email</div></td>";   
	        echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'>$comment</div></td>";
	        echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'>$lastLoginTime</div></td>";          
	        echo "<td height='20' bgcolor='#FFFFFF'><div align='center' class='STYLE21'>";
	        if($role==1){
				echo "<a href='#'><img src='../images/del.gif' width='10' height='10' title='删除' onclick='delOne($userId)'/> </a>&nbsp;|&nbsp;";
			}
        	echo "<a href='../../action/userAction.php?op=get&id=$userId' target='rightFrame'><img src='../images/edit.gif' width='10' height='10' title='编辑'/></a>";
    		echo "</div></td>";        
		echo "</tr>";
      }
	 ?>
    </table></td>
  </tr>
  <tr>
    <td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="33%"><div align="left">
        	<span class="STYLE22">&nbsp;&nbsp;&nbsp;&nbsp;
	        	共有<strong><?php echo $totalRows ?></strong> 条记录，
	        	当前第<strong><?php echo $currentPage ?></strong> 页，
	        	共 <strong><?php echo $totalPages ?></strong> 页
        	</span>
        </div></td>
        <td width="67%"><table width="312" border="0" align="right" cellpadding="0" cellspacing="0">
          <tr>
            <td width="49"><div align="center"><a href='../../action/userAction.php?op=list&p=<?php echo $firstPage?>' target='rightFrame'><img src="../images/main_54.gif" width="40" height="15" /></a></div></td>
            <td width="49"><div align="center"><a href='../../action/userAction.php?op=list&p=<?php echo $prewPage?>' target='rightFrame'><img src="../images/main_56.gif" width="45" height="15" /></a></div></td>
            <td width="49"><div align="center"><a href='../../action/userAction.php?op=list&p=<?php echo $nextPage?>' target='rightFrame'><img src="../images/main_58.gif" width="45" height="15" /></a></div></td>
            <td width="49"><div align="center"><a href='../../action/userAction.php?op=list&p=<?php echo $lastPage?>' target='rightFrame'><img src="../images/main_60.gif" width="40" height="15" /></a></div></td>
            <td width="37" class="STYLE22"><div align="center">转到</div></td>
            <td width="22"><div align="center">
              <input type="text" name="textfield" id="textfield"  style="width:20px; height:12px; font-size:12px; border:solid 1px #7aaebd;"/>
            </div></td>
            <td width="22" class="STYLE22"><div align="center">页</div></td>
            <td width="35"><img src="../images/main_62.gif" width="26" height="15"  onclick="jumpToPage()"/></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
